#########################################################################################
# Package       TestModule::HandlerSimple
# Description:  Simple Test Handler
# Created       Tue Mar 30 01:21:09 2010
# SVN Id        $Id: HandlerSimple.pm 2 2010-03-30 07:30:05Z mark.dootson $
# Copyright:    Copyright (c) 2010 Mark Dootson
# Licence:      This program is free software; you can redistribute it 
#               and/or modify it under the same terms as Perl itself
#########################################################################################

package TestModule::HandlerSimple;

#########################################################################################

use strict;
use warnings;
use Wx::Perl::SimpleThread::Handler;
use base qw( Wx::Perl::SimpleThread::Handler );
use Test::More;

sub new {
    my $class = shift;
    my $self = $class->SUPER::new(@_);
    $self->{_not_completed} = 1;
    return $self;
}

sub run_number {
    my($self, $number) = @_;
    $self->{_not_completed} = 1;
    $self->{_runnumber} = $number;
    $self->send_thread_request($number);
}

sub on_thread_data_event {
    my($self, $data) = @_;
    is($data, $self->{_runnumber}, 'on thread data event');
}

sub on_thread_request_complete {
    my($self, $data) = @_;
    is($data, $self->{_runnumber} + 5, 'on thread request complete');
    $self->{_not_completed} = 0;
}

sub not_complete { $_[0]->{_not_completed}; }

1;
